﻿<%@ Application Language="C#" %>
<%@ Import Namespace="System.Web.Routing" %>
<script RunAt="server">

    void Application_Start(object sender, EventArgs e)
    {
        //在应用程序启动时运行的代码
        RegisterRoutes(RouteTable.Routes);

    }

    void Application_End(object sender, EventArgs e)
    {
        //在应用程序关闭时运行的代码

    }

    void Application_Error(object sender, EventArgs e)
    {
        //在出现未处理的错误时运行的代码

    }

    void Session_Start(object sender, EventArgs e)
    {
        // 在新会话启动时运行的代码
        Session.Timeout = 600;


    }

    void Session_End(object sender, EventArgs e)
    {
        //在会话结束时运行的代码。 
        // 注意: 只有在 Web.config 文件中的 sessionstate 模式设置为
        // InProc 时，才会引发 Session_End 事件。如果会话模式 
        //设置为 StateServer 或 SQLServer，则不会引发该事件。

    }

    void RegisterRoutes(RouteCollection routes)
    {
        routes.MapPageRoute("index",
            "index.html",
            "~/Default.aspx");
        routes.MapPageRoute("about",
            "about",
            "~/About.aspx");
        routes.MapPageRoute("doctor",
            "doctor",
            "~/Doctor.aspx");
        routes.MapPageRoute("sitemap",
            "sitemap",
            "~/Sitemap.aspx");
        routes.MapPageRoute("chat",
            "chat",
            "~/Chat.aspx");
        routes.MapPageRoute("technology",
            "{urlname}",
            "~/ArticleList.aspx",
            false,
            null,
            new RouteValueDictionary { { "urlname", "technology|guide|zhengzhuang|case|xinwen|yihuanwenda" } });
        routes.MapPageRoute("equipment",
            "equipment",
            "~/Equipment.aspx");
        routes.MapPageRoute("topic",
            "topic",
            "~/Topic.aspx");
        routes.MapPageRoute("faq",
            "faq",
            "~/Faq.aspx");
        routes.MapPageRoute("faqlist",
             "faq/{urlname}",
             "~/Faq.aspx",
             false,
           null,
           new RouteValueDictionary { { "urlname", "[a-zA-Z0-9]{1,100}" } });
        routes.MapPageRoute("faqinfo",
            "faq/{urlname}/{id}.html",
            "~/FaqInfo.aspx",
            false,
          null,
          new RouteValueDictionary { { "urlname", "[a-zA-Z0-9]{1,100}" }, { "id", "[a-zA-Z0-9]{1,100}" } });
        routes.MapPageRoute("error",
            "error.html",
            "~/Error.aspx");
        routes.MapPageRoute("404",
            "404.html",
            "~/NoPage.aspx");
        routes.MapPageRoute("search",
           "search",
           "~/Search.aspx");
        routes.MapPageRoute("disease",
           "{urlname}",
           "~/Disease.aspx",
           false,
           null,
           new RouteValueDictionary { { "urlname", "[a-zA-Z0-9]{1,100}" } });
        routes.MapPageRoute("articlelist",
            "{purlname}/{urlname}",
            "~/ArticleList.aspx",
            false,
            null,
            new RouteValueDictionary { { "purlname", "[a-zA-Z0-9]{1,100}" }, { "urlname", "[a-zA-Z0-9]{1,100}" } });
        routes.MapPageRoute("articleinfo",
          "{urlname}/{id}.html",
          "~/ArticleInfo.aspx",
          false,
          null,
          new RouteValueDictionary { { "urlname", "[a-zA-Z0-9]{1,100}" }, { "id", "[a-zA-Z0-9]{1,100}" } });
        routes.MapPageRoute("articleinfo1",
           "{purlname}/{urlname}/{id}.html",
           "~/ArticleInfo.aspx",
           false,
           null,
           new RouteValueDictionary { { "purlname", "[a-zA-Z0-9]{1,100}" }, { "urlname", "[a-zA-Z0-9]{1,100}" }, { "id", "[a-zA-Z0-9]{1,100}" } });
        //routes.MapPageRoute("page",
        //    "{urlname}",
        //    "~/{urlname}.aspx",
        //    false,
        //    null,
        //    new RouteValueDictionary { { "urlname", "[a-zA-Z0-9]{1,100}" } });
    }
       
</script>
